// 全局组件
<template>
  <van-tabbar route>
    <van-tabbar-item to="/home" icon="home-o">首页</van-tabbar-item>
    <van-tabbar-item to="/list" icon="search">列表页</van-tabbar-item>
    <van-tabbar-item to="/shopcar" icon="home-o" :badge="goodsLength"
      >购物车</van-tabbar-item
    >
    <van-tabbar-item to="/user" icon="search">会员中心</van-tabbar-item>
  </van-tabbar>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const { mapState, mapMutations } = createNamespacedHelpers("shopcar");
export default {
  computed: {
    ...mapState(["goodsLength"]),
  },
  methods: {
    ...mapMutations(["getGoodsLength"]),
  },
  created(){
    this.getGoodsLength()
  }
};
</script>

<style></style>
